package com.neoCalf.neoCommon.enums;

import com.neoCalf.neoCommon.utils.DataTool;
import lombok.Getter;


@Getter
public enum UserContactStatusEnum {
    NOT_FRIEND(0, "非好友"),
    FRIEND(1, "好友"),
    DEL(2, "删除好友"),
    BLACKLIST(3, "拉黑好友");
    private final Integer status;
    private final String description;

    UserContactStatusEnum(Integer status, String description) {
        this.status = status;
        this.description = description;
    }

    public static UserContactStatusEnum getTypeEnumByStatus(Integer status) {
        if (DataTool.isNull(status)) {
            return null;
        }
        for (UserContactStatusEnum statusEnum : UserContactStatusEnum.values()) {
            if (statusEnum.getStatus().equals(status)) {
                return statusEnum;
            }
        }
        return null;
    }

    public static boolean allowSend(UserContactStatusEnum statusEnum) {
        return statusEnum.equals(FRIEND) || statusEnum.equals(BLACKLIST);
    }
}
